package com.dotflat.survey.domain;

import com.dotflat.rest.domain.AreableObjectBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "dw_survey_answer")
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("答卷")
public class SurveyAnswer extends AreableObjectBase {

    @ApiModelProperty("问卷id")
    @Column(columnDefinition = "varchar(32)  COMMENT '问卷id'", nullable = false)
    private String sheetId;

    @ApiModelProperty("家长id")
    @Column(columnDefinition = "varchar(32)  COMMENT '家长id'", nullable = false)
    private String parentId;

    @ApiModelProperty("宝宝id")
    @Column(columnDefinition = "varchar(32)  COMMENT '宝宝id'", nullable = false)
    private String childId;

    @ApiModelProperty("答题卡数据")
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "answer")
    @OrderBy("seq desc")
    private List<SurveyAnswerItem> items;

}
